package org.zhadoop.stream.cql.semanticanalyzer.parser.context;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.analyzecontext.expressiondesc.ExpressionDescribe;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextreplacer.ParseContextReplacer;
import org.zhadoop.stream.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

/**
 * prvious 表达式解析内容
 * @author zwd
 *
 */
public class ExpressionPreviousContext extends BaseExpressionParseContext{

	private static final Logger LOG = LoggerFactory.getLogger(ExpressionPreviousContext.class);
	private List<BaseExpressionParseContext> expressions;
	
	public ExpressionPreviousContext() {
		expressions = Lists.newArrayList();
	}
	
	@Override
	public void walkChildAndReplace(ParseContextReplacer replacer) {
		
	}

	@Override
	protected ExpressionDescribe createExpressionDesc() throws SemanticAnalyzerException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
        sb.append("PREVIOUS(");
        sb.append(Joiner.on(", ").join(expressions));
        sb.append(")");
        return sb.toString();
	}

	@Override
	protected void walkChild(ParseContextWalker walker) {
		// TODO Auto-generated method stub
		
	}

	public List<BaseExpressionParseContext> getExpressions() {
		return expressions;
	}

	public void setExpressions(List<BaseExpressionParseContext> expressions) {
		this.expressions = expressions;
	}

}
